package com.sailmi.auth.userprovider.sailplat.feign;

import com.sailmi.common.model.auth.AuthUser;
import com.sailmi.common.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * User Feign接口类
 *
 * @author yzh
 */
@FeignClient(
	value = "api-service",
		configuration = FeignConfiguration.class,
	fallback = com.sailmi.auth.userprovider.sailplat.feign.UserClientFallback.class
)
public interface IUserClient {

	String API_PREFIX = "/auth/userproxy";
	/**
	 * 获取用户信息
	 *
	 * @param authUser 用户信息
	 * @return
	 */
	@PostMapping(API_PREFIX + "/registerUser")
	R<AuthUser> registerUser(@RequestBody AuthUser authUser);
	/**
	 * 获取用户信息
	 *
	 * @param authUser 用户信息
	 * @return
	 */
	@GetMapping(API_PREFIX + "/updateUser")
	R<AuthUser> updateUser(@RequestBody AuthUser authUser);
	/**
	 * 获取用户信息
	 *
	 * @param userId 用户id
	 * @return
	 */
	@GetMapping(API_PREFIX + "/getUserbyId")
	R<AuthUser> userInfo(@RequestParam("userId") Long userId);
	/**
	 * 获取用户信息
	 *
	 * @param userAccount 用户帐号
	 * @return
	 */
	@GetMapping(API_PREFIX + "/getUserByAccount")
	R<AuthUser> userInfo(@RequestParam("userAccount") String userAccount);

	/**
	 * 获取用户信息
	 * @param userAccount    账号
	 * @param userPass   密码
	 * @return
	 */
	@GetMapping(API_PREFIX + "/getUserByAuth")
	R<AuthUser> userInfo(@RequestParam("userAccount") String userAccount, @RequestParam("userPass") String userPass);


	@PostMapping(API_PREFIX + "/resetUserPassword")
    Boolean  resetUserPass(@RequestParam("userAccount") String userAccount);

	/**
	 * 获取用户角色信息
	 * @param userAccount   用户的guid
	 * @return
	 */
	@GetMapping(API_PREFIX + "/getRoles")
	R<List> getRoles(@RequestParam("userAccount") String userAccount);


	/**
	 * 获取用户角色信息
	 * @param userAccount    账号
	 * @return
	 */
	@GetMapping(API_PREFIX + "/getRights")
	R<List> getRights(@RequestParam("userAccount") String userAccount);

}
